package com.xzbd.gef.cmd;

import org.eclipse.draw2d.geometry.Rectangle;

import com.xzbd.gef.model.text.NotesNode;

public class NotesNodeChangeLayoutCommand extends AbstractLayoutCommand{

	private NotesNode model;
	private Rectangle layout;
	private Rectangle oldLayout;
	
	public void execute(){
		model.setLayout(layout);
	}
	@Override
	public void setConstraint(Rectangle rect) {
		this.layout = rect;
	}

	@Override
	public void setModel(Object model) {
		this.model = (NotesNode)model;
		this.oldLayout =((NotesNode)model).getLayout();
	}
	
	public void undo(){
		this.model.setLayout(this.oldLayout);
	}

	//Override
	public boolean canExecute()
	{
		return true;
	}
}